/* 移动端专用样式 */
@media screen and (max-width: 768px) {
  /* 基础样式调整 */
  body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    background-attachment: fixed;
    font-family: 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 防止水平滚动 */
    overflow-x: hidden;
    width: 100%;
    position: fixed;
    height: 100%;
  }
  
  /* 容器样式优化 */
  .upload-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
    /* 替换白色背景为科技风背景 */
    background: linear-gradient(135deg, rgba(18, 24, 38, 0.97), rgba(33, 43, 69, 0.97));
    padding: 0;
    overflow: hidden;
    /* 防止水平滚动 */
    position: relative;
  }
  
  /* 内容容器优化 */
  .content-container {
    padding: 12px;
    overflow-y: auto;
    overflow-x: hidden; /* 防止水平滚动 */
    height: calc(100vh - 60px);
    width: 100%;
    box-sizing: border-box; /* 确保padding不会增加宽度 */
    /* margin-top: 60px; */
  }
  
  /* 确保所有子元素不超出容器宽度 */
  .upload-area, 
  .visualization-container, 
  .file-list,
  .button-group,
  .upload-default-content,
  .video-container,
  .selected-image,
  .probability-container {
    max-width: 100%;
    box-sizing: border-box;
  }
  
  /* 确保图片不会超出容器 */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* 移动端按钮优化 */
  @media screen and (max-width: 768px) {
    /* 按钮组样式优化 */
    .button-group {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      margin: 20px 10px 25px;
      padding: 0;
      gap: 15px;
    }
    
    /* 在移动端，只显示两个主要按钮 */
    #startCamera, #captureNative {
      flex: 1;
      margin: 0;
      min-width: 0;
      padding: 15px 5px;
      border-radius: 12px;
      font-size: 1rem;
      font-weight: 500;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
      transition: all 0.3s ease;
      border: none;
      color: white;
      position: relative;
      overflow: hidden;
      z-index: 1;
    }
    
    /* 相册按钮样式 */
    #captureNative {
      background: linear-gradient(135deg, rgba(65, 88, 208, 0.8), rgba(83, 178, 254, 0.8));
      border: 1px solid rgba(83, 178, 254, 0.3);
    }
    
    /* 摄像头按钮样式 */
    #startCamera {
      background: linear-gradient(135deg, rgba(29, 151, 108, 0.8), rgba(147, 249, 185, 0.8));
      border: 1px solid rgba(147, 249, 185, 0.3);
    }
    
    /* 隐藏拍照按钮，因为我们使用原生相机 */
    #takePhoto {
      display: none;
    }
    
    .upload-btn {
      flex: 1;
      margin: 0 !important;
      min-width: 0;
      padding: 15px 5px !important;
      border-radius: 12px;
      font-size: 0.95rem;
      font-weight: 500;
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
      transition: all 0.3s ease;
      border: none;
      color: white;
      position: relative;
      overflow: hidden;
      z-index: 1;
      /* 添加半透明背景，减少突兀感 */
      background-color: rgba(255, 255, 255, 0.1) !important;
      backdrop-filter: blur(5px);
      border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* 使用伪元素创建渐变背景 */
    .upload-btn::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
      transition: opacity 0.3s ease;
    }
    
    /* 相册按钮样式 */
    #captureNative {
      background: linear-gradient(135deg, rgba(255, 94, 98, 0.8), rgba(255, 153, 102, 0.8));
      border: 1px solid rgba(255, 94, 98, 0.3);
    }
    
    /* 摄像头按钮样式 */
    #startCamera {
      background: linear-gradient(135deg, rgba(65, 88, 208, 0.8), rgba(83, 178, 254, 0.8));
      border: 1px solid rgba(83, 178, 254, 0.3);
    }
    
    /* 拍照按钮样式 */
    #takePhoto {
      background: linear-gradient(135deg, rgba(29, 151, 108, 0.8), rgba(147, 249, 185, 0.8));
      border: 1px solid rgba(147, 249, 185, 0.3);
    }
    
    
    /* 优化按钮文字 */
    .upload-btn {
      text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
      letter-spacing: 1px;
    }
  }
  
  /* 在现有的 @media 查询中添加以下样式 */
  
  /* 刷新指示器 */
  .refresh-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    color: #666;
    font-size: 0.9rem;
  }
  
  .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #1a2a6c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
  }
  
  @keyframes spin {
    to { transform: rotate(360deg); }
  }
  
/* Toast提示样式 */
.toast-message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(26, 42, 108, 0.9), rgba(178, 31, 31, 0.9));
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  animation: fadeInOut 2.5s ease forwards;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.toast-message.success {
  background: linear-gradient(135deg, rgba(29, 151, 108, 0.9), rgba(147, 249, 185, 0.9));
}

.toast-message.error {
  background: linear-gradient(135deg, rgba(255, 94, 98, 0.9), rgba(255, 153, 102, 0.9));
}

.toast-icon {
  font-size: 16px;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translate(-50%, -20px); }
  10% { opacity: 1; transform: translate(-50%, 0); }
  90% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -20px); }
}

  @keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -20px); }
    10% { opacity: 1; transform: translate(-50%, 0); }
    90% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
  }
  
  /* 按钮点击效果 */
  .upload-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }
  
  /* 图片项点击效果 */
  .image-item:active {
    transform: scale(0.98);
  }
  
  /* 添加科技风元素 */
  .upload-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
      radial-gradient(circle at 10% 20%, rgba(50, 120, 255, 0.05) 0%, transparent 20%),
      radial-gradient(circle at 90% 80%, rgba(50, 120, 255, 0.05) 0%, transparent 20%),
      linear-gradient(45deg, transparent 48%, rgba(50, 120, 255, 0.03) 49%, rgba(50, 120, 255, 0.03) 51%, transparent 52%),
      linear-gradient(-45deg, transparent 48%, rgba(50, 120, 255, 0.03) 49%, rgba(50, 120, 255, 0.03) 51%, transparent 52%);
    background-size: 100% 100%, 100% 100%, 20px 20px, 20px 20px;
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
  }
  
  /* 上传区域优化 */
  .upload-area {
    border: 2px dashed rgba(100, 150, 255, 0.3);
    border-radius: 15px;
    padding: 15px;
    background-color: rgba(20, 30, 50, 0.5);
    min-height: 150px;
    position: relative;
    margin-bottom: 15px;
    backdrop-filter: blur(5px);
  }
  
  /* 上传文本颜色调整 */
  .upload-text {
    text-align: center;
    color: rgba(200, 220, 255, 0.8);
    font-size: 0.9rem;
    padding: 0 10px;
  }
  
  /* 可视化容器优化 */
  .visualization-container {
    background: rgba(25, 35, 55, 0.8);
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid rgba(100, 150, 255, 0.2);
  }
  
  /* 可视化标题优化 */
  .visualization-header {
    background: linear-gradient(135deg, #1a3a6c, #2a4a8c);
    color: white;
    padding: 12px 15px;
    margin: 0;
  }
  
  /* 选择图片区域优化 */
  .selected-image {
    /* width: 100%; */
    /* height: 200px; */
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 1/1;
    background-color: rgba(15, 25, 45, 0.7);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid rgba(100, 150, 255, 0.1);
  }
  
  /* 占位符颜色调整 */
  .no-image-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: rgba(150, 180, 255, 0.6);
  }
  
  /* 概率标签颜色调整 */
  .probability-label {
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: rgba(200, 220, 255, 0.9);
    font-weight: 500;
  }
  
  /* 概率条背景调整 */
  .probability-bar-container {
    height: 25px;
    background-color: rgba(30, 40, 60, 0.6);
    border-radius: 25px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  }
  
  /* 概率条颜色调整 */
  .probability-bar {
    height: 100%;
    background: linear-gradient(to right, #4a90e2, #00d2ff);
    border-radius: 25px;
    transition: width 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
  }
  
  /* 概率值颜色调整 */
  .probability-value {
    position: absolute;
    right: 10px;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }
  
  /* 设备提示颜色调整 */
  .device-hint {
    text-align: center;
    color: rgba(150, 180, 255, 0.6);
    font-size: 0.8rem;
    margin-top: 15px;
    padding: 10px;
    border-top: 1px solid rgba(100, 150, 255, 0.2);
  }
  
  .desktop-hint {
    display: none;
  }
  
  /* 浮动元素优化 */
  .floating-element {
    display: none; /* 在移动端隐藏装饰性元素以提高性能 */
  }
  
  /* 技术线条和圆圈优化 */
  .tech-circles, .tech-line, .digital-dots {
    opacity: 0.3; /* 降低装饰元素的不透明度 */
  }
  
  /* 安全区域适配（针对刘海屏） */
  @supports (padding-top: env(safe-area-inset-top)) {
    body {
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }
  }
  
  /* 暗色模式支持 - 可以移除或简化，因为我们已经使用了深色科技风格 */
  @media (prefers-color-scheme: dark) {
    /* 暗色模式下可以稍微调整一些颜色，使其更暗一些 */
    .upload-container {
      background: linear-gradient(135deg, rgba(10, 15, 25, 0.97), rgba(20, 30, 50, 0.97));
    }
    
    .upload-area {
      background-color: rgba(15, 20, 35, 0.6);
    }
    
    .visualization-container {
      background: rgba(15, 25, 40, 0.9);
    }
  }
}

/* 摄像头切换按钮样式优化 */
.camera-switch-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  z-index: 100;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.camera-switch-btn:active {
  background-color: rgba(0, 0, 0, 0.7);
  transform: scale(0.95);
}

/* 视频容器样式优化 */
.video-container {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin: 10px 0;
  display: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

#video {
  width: 100%;
  border-radius: 12px;
  background-color: #101820;
  transform: scale(1.01);
}

